package com.liuqi.openai.data.message;

import static com.liuqi.openai.data.message.ChatMessageType.USER;

/**
 * 用户消息
 *
 * @author liuqi
 * @date 2025/7/19
 **/
public class UserMessage extends ChatMessage {

    private final String name;

    UserMessage(String name, String text) {
        super(text, USER);
        this.name = name;
    }

    public String name() {
        return name;
    }

    public static UserMessage from(String text) {
        return new UserMessage(null, text);
    }

    public static UserMessage from(String name, String text) {
        return new UserMessage(name, text);
    }

    @Override
    public String toString() {
        return "UserMessage{" +
                "name='" + name + '\'' +
                ", text='" + text + '\'' +
                ", type=" + type +
                '}';
    }
}
